<template>
	<div class="about w944">
		<alert ref="alert"></alert>
		<div class="label_top">
			<p><i class="line"></i>关于我们</p>
		</div>
		<div class="addCont">
			<div class="addSubJieshao">
				<span style="margin-bottom: 25px;display: block;width: 96px;">内容介绍：</span>
				<vue-ueditor-wrap v-model="msg" :config="myConfig" style="margin-left: 74px;margin-bottom: 30px;"></vue-ueditor-wrap>
			</div>
			<div class="footerButton">
				<a @click="submit" v-bind:style="{background: clickLock==true ? '#44CEF6' : '#3a8ee6'}" v-if="about.gywm_save">保存</a>
				<a @click="cancel" class="cancel" v-if="about.gywm_cancel">取消</a>
			</div>
		</div>
	</div>
</template>
<script>
	import alert from '../../components/Alert.vue';
	export default {
		data() {
			return {
				clickLock:true,
				about:'',
				id:'',
				msg: '',
				myConfig: {
					autoHeightEnabled: false,
					initialFrameHeight: 420,
					initialFrameWidth: '858'
				},
			}
		},
		methods: {
			getTableList() {
				this.$ajax({
					url: this.$root.jifuUrl + "/mns/aboutUs/aboutUsDetails",
					headers: {'ContentType': 'application/json; charset=utf-8'},
					method: 'POST',
					data: {rootcompanyid:1},
					success: res => {
						if(res.data.code == 200) {
							this.msg = res.data.data.details;
							this.id = res.data.data.id;
						}
					}
				});
			},
			submit(){
				if(this.clickLock==true){
					this.clickLock=false;
					this.$ajax({
						url: this.$root.jifuUrl + '/mns/aboutUs/addOrUpdateAboutUsDetails',
						headers: {'ContentType': 'application/json; charset=utf-8'},
						data: {
							id: this.id,
							details:this.msg,
							rootcompanyid:1
						},
						method: 'PUT',
						success: res => {
							if(res.data.code == 200) {
								this.$refs.alert.show({
									alertText: '保存成功',
									alertSubmit: function() {
										alertStatus: 0;
										this.getTableList();
									}
								});
								this.$rootFunction().deleteInTableList();
							}else{
								this.failText = res.data.message;
								this.$rootFunction().deleteResFail();
							}
						}
					});
				}
			},
			cancel(){
				this.$router.go(0);
			}
		},
		components:{
			alert
		},
		mounted: function() {
			this.getTableList();
			this.about = this.$root.huasan.about;
		}
	}
</script>